<template>
  <div class="app-container">
        <el-row :gutter="20">
          <!--案件列表数据-->
          <el-col :span="20"
                  :xs="24">
            <el-form :model="queryParams"
                     ref="queryForm"
                     size="small"
                     :inline="true"
                     v-show="showSearch"
                     label-width="68px">

              <el-form-item label="发明人"
                            prop="inventorName">
                <el-input v-model="queryParams.inventorName"
                          placeholder="请输入发明人"
                          clearable
                          style="width: 240px"
                          @keyup.enter.native="handleQuery" />
              </el-form-item>
              <el-form-item label="客户名称"
                            prop="customerContact">
                <el-input v-model="queryParams.customerContact"
                          placeholder="请输入客户名称"
                          clearable
                          style="width: 240px"
                          @keyup.enter.native="handleQuery" />
              </el-form-item>
              <el-form-item label="专利名称"
                            prop="patentName">
                <el-input v-model="queryParams.patentName"
                          placeholder="请输入专利名称"
                          clearable
                          style="width: 240px"
                          @keyup.enter.native="handleQuery" />
              </el-form-item>
              <el-form-item label="专利类型" prop="patentTypeId">
                <el-select v-model="queryParams.patentTypeId" placeholder="专利类型" clearable>
                  <el-option
                    v-for="dict in dict.type.ipms_patend_type"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  />
                </el-select>
            </el-form-item>

              <el-form-item>
                <el-button type="primary"
                           icon="el-icon-search"
                           size="mini"
                           @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh"
                           size="mini"
                           @click="resetQuery">重置</el-button>
              </el-form-item>
            </el-form>

            <el-table :data="inventorList">
              <el-table-column label="发明人"
                               align="center"
                               key="inventorName"
                               prop="inventorName"
                               v-if="columns[0].visible">
              </el-table-column>

              <el-table-column label="证件号码"
                               align="center"
                               key="inventorNo"
                               prop="inventorNo"
                               v-if="columns[1].visible"
                               :show-overflow-tooltip="true" />
              <el-table-column label="客户"
                               align="center"
                               key="customerContact"
                               prop="customerContact"
                               v-if="columns[2].visible"
                               :show-overflow-tooltip="true" />
              <el-table-column label="专利名称"
                               align="center"
                               key="patentName"
                               prop="patentName"
                               v-if="columns[3].visible"
                               :show-overflow-tooltip="true" />
              <el-table-column label="专利类型"
                               align="center"
                               key="patentTypeId"
                               prop="patentTypeId"
                               :formatter="formatPatentType"
                               v-if="columns[4].visible"
                               :show-overflow-tooltip="true" >
                  <template slot-scope="scope">
                    <dict-tag :options="dict.type.ipms_patend_type" :value="scope.row.patentTypeId"/>
                  </template>
              </el-table-column>
              <el-table-column label="创建时间"
                               align="center"
                               key="createTime"
                               prop="createTime"
                               v-if="columns[5].visible"
                               width="200px" />
            </el-table>
            <pagination v-show="total > 0"
                        :total="total"
                        :page.sync="queryParams.pageNum"
                        :limit.sync="queryParams.pageSize"
                        @pagination="getInventorList" />
          </el-col>
        </el-row>
      </div>
</template>

<script>
//引入题目列表方法
import {findAllInventor} from '@/api/patent/Bao'
export default {
  //声明使用字典
  dicts: [
    //专利类型字典
    'ipms_patend_type',
    //业务类型字典
    'ipms_contract_case_type',
    //案件状态
    'ipms_case_status',
    //业务类型字典
    'ipms_contract_case_type'
  ],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 显示搜索条件
      showSearch: true,

      // 列信息
      columns: [
        { key: 0, visible: true },
        { key: 1, visible: true },
        { key: 2, visible: true },
        { key: 3, visible: true },
        { key: 4, visible: true },
        { key: 5, visible: true },
      ],

      //
      formatPatentType: undefined,

      /* 查询参数 */
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        inventorName:undefined,
        inventorNo:undefined,
        patentName:undefined,
        patentTypeId:undefined,
        customerContact:undefined,
      },

      //发明人列表
      inventorList: [],
    }
  },

  created() {
    this.getInventorList();
  },

  methods: {

    /** 搜索按钮操作 */
    handleQuery() {
      findAllInventor(this.queryParams).then((response) => {
        this.inventorList = response.rows
      })
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        inventorName:undefined,
        inventorNo:undefined,
        patentName:undefined,
        patentTypeId:undefined,
        customerContact:undefined,
      }
      this.getInventorList();
    },

    /* 业务方法 */
    //案件列表
    getInventorList(){
      findAllInventor(this.queryParams).then((response) => {
        this.inventorList = response.rows
        this.total = response.total
      })
    },
  },
}
</script>


